<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>4. 完善以下getData函数,实现外部对data数据的获取</title>
</head>
<body>
  <script>
    function getData(){
      return new Promise((resolve,reject)=>{
        setTimeout(()=>{
            let data = {code:200,msg:'success',data:[]}
            resolve(data)
        },1000)

      })
    }

    ;(async function(){
      const data = await getData()
      console.log(data);
    })()

  </script>

</body>

</html>